package com.faceboob.api;

import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.Parameter;
import com.restfb.types.FacebookType;

public class PostToWall {

	/**
	 * @param args
	 */
	public static void main(final String[] args) {
		postOnPage(
				"BAABZBxQZCZAlBwBAIyJUiZByDhUGB4pxHCTzEgFhkeWF97RpJarQEWWZBmn4TCBTTvyXwiiZBFnJaDhKUX9oAdXfEwLXsY1KyHC4fv5Ma0aytsCvYZBtFQVd3He9ifIGpLAobwZC5cfomirg0L6Q5RUeY7W6KqcbcpIZBiZCsEjaOBKDhilHc0JfOZCdoKhfPJ5X2ENnPMmNpBh6GZAby05qQeMmaTh4yyMjxzEHmQ88cZAxZBOwZDZD",
				"http://www.google.com", "google");

	}

	public static String postOnPage(final String acess_token, final String link, final String message) {

		FacebookClient facebookClient;

		facebookClient = new DefaultFacebookClient(acess_token);

		System.out.println("* Feed publishing Page *");

		final FacebookType publishMessageResponse = facebookClient.publish("BeautyAmazonOffers/links", FacebookType.class,
				Parameter.with("link", link), Parameter.with("message", message));

		System.out.println("Published message ID: " + publishMessageResponse.getId());

		return "Published message ID: " + publishMessageResponse.getId();

	}

	public static void postOnUser(final String acess_token, final String link, final String message, final String description,
			final String image, final String name) {

		FacebookClient facebookClient;

		facebookClient = new DefaultFacebookClient(acess_token);

		System.out.println("* Feed publishing User *");

		final FacebookType publishMessageResponse = facebookClient.publish("me/feed", FacebookType.class, Parameter.with("link", link),
				Parameter.with("message", message), Parameter.with("description", description), Parameter.with("name", name),
				Parameter.with("image", image));

		System.out.println("Published message ID: " + publishMessageResponse.getId());

	}

}
